{include file="public/head" /}
{include file="public/js_ueditor" /}
<!--有理想的地方，地狱都是天堂-->
<!--Copyright @ df81.com 版权所有-->
<!--作者: 南国老符 邮箱：1062129401@qq.com-->
        <!-- 左侧菜单 开始 -->
        <div class="sidebar">
            <nav>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy d-block d-md-none" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_content" /}
                </ul>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy d-block d-md-none" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_data" /}
                </ul>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_global" /}
                </ul>
                <ul class="nav nav-pills nav-sidebar flex-column nav-flat nav-legacy d-block d-md-none" data-widget="treeview" role="menu" data-accordion="false">
                    {include file="public/left_system" /}
                </ul>
            </nav>
        </div>
        <!-- 左侧菜单 结束 -->
    </aside>
    <!-- 左侧 结束 -->
    <!-- 右侧 开始 -->
    <div class="content-wrapper">
        <!-- 内容导航 开始 -->
        <div class="content-header py-2 bg-white mb-3">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-sm-12">
                        <ol class="breadcrumb">
                            <li>{:lang('v_global')}<i class="fas fa-angle-right mx-2"></i></li>
                            <li>{:lang('v_global')}<i class="fas fa-angle-right mx-2"></i></li>
                            <li>{:lang('v_navigation')} {:lang('v_manage')}<i class="fas fa-angle-right mx-2"></i></li>
                            <li>{empty name="rs.id"}{:lang('v_add')}{else /}{:lang('v_edit')}{/empty} {:lang('v_navigation')}</li>
                        </ol>
                    </div>
                </div>
            </div>
        </div>
        <!-- 内容导航 结束 -->
        <!-- 内容主体 开始 -->
        <section class="content">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-md-12">
                        <div class="w-100 pt-3 pb-2 bg-white rounded mb-3">
                            <div class="row">
                                <div class="col-md-12">
                                    <a class="btn btn-default mb-2 mr-2" href="{:url('/navigation/index',['lang'=>$lang,'client'=>'pc'])}"><i class="fas fa-fw fa-desktop mr-1"></i>{:lang('v_client_pc')}</a>
                                    <a class="btn btn-default mb-2 mr-2" href="{:url('/navigation/index',['lang'=>$lang,'client'=>'wap'])}"><i class="fas fa-fw fa-mobile-alt mr-1"></i>{:lang('v_client_mobile')}</a>
                                    {if config('app.isdisplay.uniapp') eq 1}
                                        <a class="btn btn-default mb-2 mr-2" href="{:url('/navigation/index',['lang'=>$lang,'client'=>'app'])}"><i class="fab fa-fw fa-android mr-1"></i>{:lang('v_client_uniapp')}</a>
                                    {/if}
                                    <a class="btn mb-2 mr-2 btn-default" href="{:url('/navigation/index',['lang'=>$lang,'signid'=>9,'client'=>input('client')])}"><i class="fa fa-fw fa-recycle mr-1"></i>{:lang('v_recycle')}</a>
                                    <a class="btn btn-success mb-2 mr-2" href="{:url('/navigation/edit',['lang'=>$lang,'client'=>input('client')])}"><i class="fa fa-fw fa-plus-circle mr-1"></i>{:lang('v_add')} {:lang('v_navigation')}</a>
                                    {if config('app.isdisplay.typeattribute') eq 1}
                                        <a class="btn btn-default mb-2 mr-2" href="{:url('/attribute/index',['lang'=>$lang,'tabledir'=>'navigation'])}"><i class="fa fa-fw fa-tag mr-1"></i>{:lang('v_attribute')} {:lang('v_manage')}</a>
                                        <a class="btn btn-default mb-2" href="{:url('/attribute/edit',['lang'=>$lang,'tabledir'=>'navigation'])}"><i class="fa fa-fw fa-plus-circle mr-1"></i>{:lang('v_add')} {:lang('v_attribute')}</a>
                                    {/if}
                                </div>
                            </div>
                        </div>
                        <div class="card card-outline card-success">
                            <div class="card-header"><i class="fas fa-edit mr-1"></i>{empty name="rs.id"}{:lang('v_add')}{else /}{:lang('v_edit')}{/empty} {:lang('v_navigation')}</div>
                            <div class="card-body">
                                <form name="form_edit" id="form_edit" method="post" action="{:url('/navigation/edit',['lang'=>$lang])}">
                                    <input type="hidden" name="id" value="{$rs.id}">
                                    <input type="hidden" name="lang" value="{$lang}">
                                    {php}$clientArr = explode(',',$rs['client']);{/php}
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right text-danger">{:lang('v_title')} *</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="title" value="{$rs.title}" />
                                        </div>
                                    </div>
                                    <div class="row form-group web {if in_array('app',$clientArr)}d-none{/if}">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_sub')} {:lang('v_title')}</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="subtitle" value="{$rs.subtitle}" />
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 text-right">{:lang('v_client')}</div>
                                        <div class="col-md-4">
                                            <label class="form-check form-check-inline">
                                                {php}$client_array=explode(',',$rs['client']);{/php}
                                                <input type="checkbox" name="client[]" value="pc" {if in_array('pc',$client_array) or $rs['client'] eq ''}checked="checked"{/if} class="form-check-input">{:lang('v_client_pc')}
                                            </label>
                                            <label class="form-check form-check-inline">
                                                <input type="checkbox" name="client[]" value="wap" {if in_array('wap',$client_array) or $rs['client'] eq ''}checked="checked"{/if} class="form-check-input">{:lang('v_client_mobile')}
                                            </label>
                                            <label class="form-check form-check-inline {if config('app.isdisplay.uniapp') neq 1}d-none{/if}">
                                                <input type="checkbox" name="client[]" value="app" {if in_array('app',$client_array)}checked="checked"{/if} class="form-check-input">{:lang('v_client_uniapp')}
                                            </label>
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 text-right">{:lang('v_attribute')}</div>
                                        <div class="col-md-9">
                                            <label class="form-check form-check-inline">
                                                <input type="radio" name="att_type" value="head"{if $rs.att_type eq 'head' or $rs.att_type eq ''} checked="checked"{/if} class="form-check-input" /> {:lang('v_head')}
                                            </label>
                                            <label class="form-check form-check-inline">
                                                <input type="radio" name="att_type" value="tile"{if $rs.att_type eq 'tile'} checked="checked"{/if} class="form-check-input" /> {:lang('v_head')} {:lang('v_tile')}
                                            </label>
                                            <label class="form-check form-check-inline">
                                                <input type="radio" name="att_type" value="foot"{if $rs.att_type eq 'foot'} checked="checked"{/if} class="form-check-input" /> {:lang('v_foot')}
                                            </label>
                                            {volist name="attribute" id="attributeRs"}
                                            <label class="form-check form-check-inline">
                                                <input type="radio" name="att_type" value="{$attributeRs.title}"{eq name="rs.att_type" value="$attributeRs.title"} checked="checked"{/eq} class="form-check-input" />{$attributeRs.title}
                                            </label>
                                            {/volist}
                                        </div>
                                    </div>
                                    <div class="row web {if in_array('app',$clientArr)}d-none{/if}">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_select')}</div>
                                        <div class="col-md-4">
                                            <a class="btn btn-xs btn-success rounded mr-2 px-2 mb-2" href="{:url('/navigation/common',['lang'=>$lang])}" data-target="#modal" data-toggle="modal">{:lang('shopv_normally')} {:lang('v_navigation')}</a>
                                            {volist name="module_list" id="moduleRs"}
                                                <a class="btn btn-xs btn-success rounded mr-2 px-2 mb-2" href="{:url('/navigation/sort',['lang'=>$lang,'tabledir'=>$moduleRs['tabledir']])}" data-target="#modal" data-toggle="modal">{$moduleRs.title} {:lang('v_sort')}</a>
                                                <a class="btn btn-xs btn-success rounded mr-2 px-2 mb-2" href="{:url('/navigation/info',['lang'=>$lang,'tabledir'=>$moduleRs['tabledir']])}" data-target="#modal" data-toggle="modal">{$moduleRs.title}</a>
                                            {/volist}
                                        </div>
                                    </div>
                                    <div class="row app {if !in_array('app',$clientArr)}d-none{/if}">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_select')}</div>
                                        <div class="col-md-4">
                                            <a class="btn btn-xs btn-success rounded mr-2 px-2 mb-2" href="{:url('/navigation/common',['lang'=>$lang,'client'=>'app'])}" data-target="#modal" data-toggle="modal">{:lang('shopv_normally')} {:lang('v_navigation')}</a>
                                            {volist name="module_list" id="moduleRs"}
                                                <!-- <a class="btn btn-xs btn-success rounded mr-2 px-2 mb-2" href="{:url('/navigation/sort',['lang'=>$lang,'tabledir'=>$moduleRs['tabledir'],'client'=>'app'])}" data-target="#modal" data-toggle="modal">{$moduleRs.title} {:lang('v_sort')}</a> -->
                                                <a class="btn btn-xs btn-success rounded mr-2 px-2 mb-2" href="{:url('/navigation/info',['lang'=>$lang,'tabledir'=>$moduleRs['tabledir'],'client'=>'app'])}" data-target="#modal" data-toggle="modal">{$moduleRs.title}</a>
                                            {/volist}
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_linkurl')}</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control" name="linkurl" value="{$rs.linkurl}" />
                                        </div>
                                    </div>
                                    <div class="row form-group web {if in_array('app',$clientArr)}d-none{/if}">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_img')}</div>
                                        <div class="col-md-4">
                                            <div class="input-group">
                                                <input value="{$rs.thumb}" name="thumb" id="morepics1" type="text" class="form-control">
                                                <span class="input-group-append">
                                                    <button onclick="upImage('#morepics1');" type="button" class="btn btn-success"><i class="fas fa-cloud-upload-alt mr-1"></i>{:lang('v_upload_img')}</button>
                                                </span>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="row form-group ico {if !in_array('app',$clientArr) or $rs['att_type'] neq 'foot'}d-none{/if}">
                                        <div class="col-md-3 text-right">{:lang('v_client_uniapp')}<br><span class="text-success">{:lang('v_foot')} {:lang('v_language_ico')}</span></div>
                                        <div class="col-md-4">
                                            <div class="input-group">
                                                <input value="{$rs.ico}" name="ico" type="text" class="form-control">
                                                <span class="input-group-append">
                                                    <a class="btn btn-success" href="{:url('/navigation/ico',['lang'=>$lang,'from'=>'ico'])}" data-target="#modal_xl" data-toggle="modal"><i class="fas fa-info-circle mr-1"></i>{:lang('v_select')} {:lang('v_language_ico')}</a>
                                                </span>
                                            </div>
                                            <span class="text-muted">{:lang('v_foot_ico_tips')}</span>
                                        </div>
                                    </div>
                                    <div class="row form-group ico {if !in_array('app',$clientArr) or $rs['att_type'] neq 'foot'}d-none{/if}">
                                        <div class="col-md-3 text-right">{:lang('v_client_uniapp')}<br><span class="text-danger">{:lang('v_foot')} {:lang('v_actived')} {:lang('v_language_ico')}</span></div>
                                        <div class="col-md-4">
                                            <div class="input-group">
                                                <input value="{$rs.ico_actived}" name="ico_actived" type="text" class="form-control">
                                                <span class="input-group-append">
                                                    <a class="btn btn-success" href="{:url('/navigation/ico',['lang'=>$lang,'from'=>'actived'])}" data-target="#modal_xl" data-toggle="modal"><i class="fas fa-info-circle mr-1"></i>{:lang('v_select')} {:lang('v_language_ico')}</a>
                                                </span>
                                            </div>
                                            <span class="text-muted">{:lang('v_foot_ico_tips')}</span>
                                        </div>
                                    </div>
                                    <div class="row form-group web {if in_array('app',$clientArr)}d-none{/if}">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_parent_sort')}</div>
                                        <div class="col-md-4">
                                            <select name="parentid" class="form-control">
                                                <option value="">{:lang('v_top_sort')}</option>
                                                {foreach name="navigation" item="v"}
                                                    <option value="{$v.id}" {eq name="rs.parentid" value="$v.id"}selected="selected"{/eq} class="{if $v.att_type eq 'foot'}text-danger{/if}">
                                                        [
                                                        {switch $v.att_type}
                                                            {case head}{:lang('v_head')}{/case}
                                                            {case foot}{:lang('v_foot')}{/case}
                                                            {case tile}{:lang('v_head')} {:lang('v_tile')}{/case}
                                                        {/switch}
                                                        ]
                                                        {$v.html} {$v.title|raw}
                                                    </option>
                                                {/foreach}
                                            </select>
                                        </div>
                                    </div>
                                    <div class="row form-group">
                                        <div class="col-md-3 col-form-label text-right">{:lang('v_sequence')}</div>
                                        <div class="col-md-4">
                                            <input type="text" class="form-control checkstock" name="sequence" value="{empty name="rs.sequence"}0{else /}{$rs.sequence}{/empty}" />
                                        </div>
                                    </div>
                                    <div class="row form-group web {if in_array('app',$clientArr)}d-none{/if}">
                                        <div class="col-md-3 text-right">{:lang('v_istarget')}</div>
                                        <div class="col-md-9">
                                            <label class="form-check form-check-inline">
                                                <input type="radio" name="outflag" value="1"{eq name="rs.outflag" value="1"} checked="checked"{/eq} class="form-check-input" /> {:lang('v_yes')}
                                            </label>
                                            <label class="form-check form-check-inline">
                                                <input type="radio" name="outflag" value="0"{if $rs.outflag eq 0 or empty($rs.id)} checked="checked"{/if} class="form-check-input" />{:lang('v_no')}
                                            </label>
                                        </div>
                                    </div>
                                    {include file="public/js_edit_area" /}
                                    <div class="row">
                                        <div class="offset-md-3 col-md-9 mb-4">
                                            {if is_file(app()->getRootPath().'.env')}
                                                <button type="submit" class="btn btn-success mr-4"><i class="fa fa-check-circle mr-2"></i>{:lang('v_save')}</button>
                                            {else /}
                                                <button type="button" class="do_ajax btn btn-success mr-4" onclick="javascript:do_ajax('#form_edit','.do_ajax','{:url('/navigation/edit',['lang'=>$lang])}','{:url('/navigation/index',['lang'=>$lang,'client'=>input('client')])}');"><i class="fas fa-check-circle mr-2"></i>{:lang('v_save')}</button>
                                            {/if}
                                            <button type="button" class="btn btn-default" onclick="javascript:history.back(-1);"><i class="fa fa-angle-double-left mr-1"></i>{:lang('v_goback')}</button>
                                        </div>
                                    </div>
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <!-- 内容主体 结束 -->
    </div>
    <!-- 右侧 结束 -->
{include file="public/foot" /}
<script type="text/plain" id="input_editor" style="display:none;"></script>
{include file="public/js_upload_img" /}
<script type="text/javascript">
$('input[name="client[]"]').click(function(){
    var att_type = $('input[name="att_type"]:checked').val();
    $('input[name="client[]"]:checked').each(function(){
        $('.ico').addClass('d-none');
        if($(this).val() == 'app'){
            $('.web').addClass('d-none');
            $('.app').removeClass('d-none');
            if(att_type == 'foot'){
                $('.ico').removeClass('d-none');
            }
        }else{
            $('.web').removeClass('d-none');
            $('.app').addClass('d-none');
        }
    });
});
// 是否显示uniapp底部图标
$('input[name="att_type"]').click(function(){
    var client = false;
    $('input[name="client[]"]:checked').each(function(){
        if($(this).val() == 'app'){
            client = true;
        }
    });
    if($('input[name="att_type"]:checked').val() == 'foot' && client == true){
        $('.ico').removeClass('d-none');
    }else{
        $('.ico').addClass('d-none');
    }
});
</script>
</body>
</html>